package com.steel.yfmall.cloud.assistant.user.impl;

import com.steel.yfmall.cloud.assistant.user.CompanyShippingAddressService;
import com.steel.yfmall.cloud.assistant.po.user.CompanyShippingAddress;
import com.steel.yfmall.cloud.assistant.user.mapper.CompanyShippingAddressMapper;
import com.steel.yfmall.cloud.components.utils.utils.UtilDate;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author yuchaohua
 * @version V1.0
 * @Title: CompanyShippingAddressServiceImpl
 * @Package com.steel.yfmall.cloud.assistant.biz.service.user.impl
 * @Description: (用一句话描述该文件做什么)
 * @date 2020/12/10 20:59
 */
@Service
@Slf4j
public class CompanyShippingAddressServiceImpl implements CompanyShippingAddressService {

    @Resource
    private CompanyShippingAddressMapper companyShippingAddressMapper;

    /**
     * 获取地址信息
     * @Title: getAddressById
     * @Description: (这里用一句话描述这个方法的作用)
     * @Param addressId 参数说明
     * @return com.steel.yfmall.cloud.assistant.po.user.CompanyShippingAddress    返回类型
     * @author yuchaohua
     * @date 2020/12/10 21:05
     */
    @Override
    public CompanyShippingAddress getAddressById(int addressId){
        if (addressId <= 0){
            return null;
        }
        return companyShippingAddressMapper.selectByPrimaryKey(addressId);
    }

    /**
     * 修改地址信息
     * @Title: updateCompanyShippingAddressById
     * @Description: (这里用一句话描述这个方法的作用)
     * @Param recordBean 参数说明
     * @return boolean    返回类型
     * @author yuchaohua
     * @date 2020/12/10 21:05
     */
    @Override
    public boolean updateCompanyShippingAddressById(CompanyShippingAddress recordBean){
        if (recordBean == null || recordBean.getAddressId() == null || recordBean.getAddressId() <= 0 ){
            return false;
        }
        recordBean.setUpdateTime(UtilDate.getDate());
        return companyShippingAddressMapper.updateByPrimaryKeySelective(recordBean) > 0;
    }

}
